#ifndef _FX_EMBED_FONT_H_
#define _FX_EMBED_FONT_H_

class CPDF_Font;
class CPDF_Dictionary;
class CPDF_Array;
class CPDF_Stream;

/** @brief Interface of Embed Font. */
class IPDF_EmbedFont : public CFX_Object
{
public:
	/**
	 * Create a Embed Font.
	 *
	 * @param[in] pFont			The source PDF font.
	 * @param[in] pDoc			The PDF document.
	 */
	static IPDF_EmbedFont*	LoadFont(CPDF_Font* pFont, CPDF_Document *pDoc);
	
	/** The destructor. */
	virtual ~IPDF_EmbedFont() {}
	
	/** Whether the source PDF font can be embeded.*/
	virtual FX_BOOL		CanEmbeded();

	/** 
	 * Get a glyph from Unicode and add into the sub PDF font.
	 * @param[in] unicode		unicode.
	 */
	virtual FX_BOOL		AddGlyphFromUnicode(FX_DWORD unicode) = 0;

	/** Receive a sub PDF font. */
	virtual CPDF_Font*	GetEmbedFont() = 0;
};
/** @brief Sub embed font.*/
class IPDF_EmbedSubFont : public CFX_Object
{
public:
	/** The constructor.*/
	IPDF_EmbedSubFont(IPDF_EmbedFont* pFont, CPDF_Document *pDoc);

	/** The destructor. */
	virtual ~IPDF_EmbedSubFont();
	
	/**
	 * Add glyph to sub embed font, this method for all fonts, standard fonts must realize these methods.
	 * @param[in] unicode  unicode.
	 * @param[in] dwGlyphIndex  The glyph index.
	 * @param[out] charsize  character size.
	 * @param[out] width     character width.
	 */
	virtual FX_DWORD	AddGlyph(FX_DWORD unicode, FX_DWORD dwGlyphIndex, int& charsize, int& width);

	/** Receive PDF Font object number according to whether the font is a vertical font or not.*/
	virtual int			GetObjNum(FX_BOOL bVert);

    /** Receive file object number for writing font descriptor. */
	virtual int			GetFontFileObjNum() = 0;

	/** Receive font type, 1: type1, 2 truetype.*/
	virtual int			GetFontType() { return 0; }

	/** Receive some pdf font attribute. */
	virtual CPDF_Dictionary*	GetCIDKeyedFontDict() = 0;
	virtual CPDF_Dictionary*	GetCIDFontDict() = 0;
	virtual CPDF_Dictionary*	GetFontDescriptor() = 0;
	virtual CPDF_Array*			GetWidthArray() = 0;
	virtual CPDF_Stream*		GetFontFileStream() = 0;
	virtual CPDF_Stream*		GetToUnicodeStream() = 0;

	/** Receive cmap And SI */
	void						GetCMapAndSI();
};

#endif
